/* 
 * File:   EventSystem.h
 * Author: aljosa
 *
 * Created on April 28, 2010, 8:19 PM
 */

#ifndef __EVENTSYSTEM_H
#define	__EVENTSYSTEM_H

//#include <queue>
#include <list>
#include "RotateEvent.h"


// EVENT - TABLE
/*
 * 0: Event
 * 1: RotateEvent
 * 2: TranslateEvent
 *
 *
 */

using namespace std;

namespace xEngine
{
    namespace CoreSystem
    {
        
        namespace Events
        {
            class EventSystem {
            public:
                // Constructors, destructors
                EventSystem();
                virtual ~EventSystem();

                void init();
                void shutDown();

                // Queue access
                Event* popEvent();
                void pushEvent(Event *event);

                // Event handling
              /*  virtual bool handleEvent(Event *event); // Main event handler
                bool handleEngineEvents(Event *event); // Engine events handler

                void setUserEventsHandler(bool (*handle)(Event*));*/

               // queue<Event*> *getQueue();
                int numPending() const;

                void print();

                // Singleton
                static EventSystem &getInstance();

                // Predefined events... we want to avoid dynamic memory allocation as much as possible
                RotateEvent rotateEvent;

            protected:
                // Singleton
                static EventSystem instance;

                // Event queue
                list<Event*> events;

                // Custom event handler
                bool (*handleUserEvents)(Event*); // User specified event handler (user event handler function pointer)

            };
        }
    }
}

#endif	/* _EVENTSYSTEM_H */

